using System;

namespace PropertyExpression.ReactiveRelation.Supplementary
{
    public static class PropertyBindContextExtensions
    {
        public static IValue<TProperty> Default<TCalcContext, TEntity, TProperty>(
            this IPropertyBindContext<TCalcContext, TEntity, TProperty> propertyBindContext)
        {
            return default(TProperty).Const();
        }

        public static Func<T, TResult> Execute<TCalcContext, TEntity, TProperty, T, TResult>(
            this IPropertyBindContext<TCalcContext, TEntity, TProperty> it,
            Func<FuncCache, TCalcContext, Func<T, TResult>> func)
        {
            return func(it.FuncCache, it.CalcContext);
        }
    }
}